#! /bin/sh
#
# 0_create_channel.sh
# Copyright (C) 2018 lijiaocn <lijiaocn@foxmail.com>
#
# Distributed under terms of the GPL license.
#

PATH=`pwd`/../../../bin:$PATH

CHANNEL_NAME="mychannel"

export FABRIC_CFG_PATH=`pwd`
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_TLS_CERT_FILE=./tls/server.crt
export CORE_PEER_TLS_KEY_FILE=./tls/server.key
export CORE_PEER_MSPCONFIGPATH=./msp
export CORE_PEER_TLS_ROOTCERT_FILE=./tls/ca.crt

export CORE_PEER_ID=cli
export CORE_LOGGING_LEVEL=DEBUG

export CORE_PEER_LOCALMSPID={{ mspid }}
export CORE_PEER_ADDRESS={{ peer }}:7051

peer channel fetch 0 $CHANNEL_NAME.block -o {{ orderer }}:7050 -c $CHANNEL_NAME --tls --cafile {{ orderer_ca }}
peer channel join -b $CHANNEL_NAME.block  
